package com.sinog.front.asynctask;

import com.sinog.core.domain.InterfaceLog;
import com.sinog.core.domain.JieKouLog;
import com.sinog.front.feign.biz.api.LogInsertService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @desc 接口日志异步插入省级日志表和部级日志表
 * @author ypc
 * @date 2022/10/20
 */
@Slf4j
@Component
public class AsyncTaskLog {

    @Autowired
    private LogInsertService logInsertService;

    /**
     * 异步执行插入省级日志表数据
     * @param interfaceLog 省级日志表实体类
     */
    @Async("taskAsync01-")
    public void asyncInsertSjLog(InterfaceLog interfaceLog){
        log.info(Thread.currentThread().getName());
        logInsertService.insertLog(interfaceLog);
    }

    /**
     * 异步执行插入部级日志表数据
     * @param jieKouLog sfb接口对接日志实体类
     */
    @Async("taskAsync01-")
    public void asyncInsertbjLog(JieKouLog jieKouLog){
        log.info(Thread.currentThread().getName());
        logInsertService.insertbuLog(jieKouLog);
    }
}